<%@page contentType="text/html; charset=UTF-8"%>
<%@ page import="org.acegisecurity.ui.AbstractProcessingFilter" %>
<%@ page import="org.acegisecurity.AuthenticationException" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<%@ include file="/jsp/common/common.jsp"%> 
      
<title>庆能(北京)环境处理综合业务平台</title>

<!-- <style type="text/css">
	
.user{ background:url(images/login/user.gif) no-repeat 1px 3px;height: 25px; }   

.key{ background:url(images/login/key.gif) no-repeat 1px 3px;height: 25px;  }   

.user,.key,.key{background-color:#FFFFFF;padding-left:20px;font-weight:bold;color:#000033;}

.login{
	background-image:url(images/login/key.gif) !important;
}
	

</style> -->
	
<link rel="stylesheet" type="text/css" href="style/login.css" />

<script type="text/javascript" src="<%=request.getContextPath()%>/js/controlCookie.js"></script>

	
<script type="text/javascript">


var screenHeight = screen.height;
var screenWidth = screen.width;

var windowname = window.name;
if(windowname!='index2'){
	//window.location.href="login.jsp";
	window.open("login.jsp","index2","menubar=no,height="+ screenHeight +",width="+ screenWidth +",crollbars=yes,location=no,status=yes,resizable=no");
	window.opener=null;
		window.open('','_self');
		window.close();
}
try{
	window.moveTo(0,0);
	window.resizeTo(screen.availWidth, screen.availHeight);
	}catch(e){
	
}


/* //初始化框	
$(function(){
	  $('#p').panel({ 

		  width:518, 

		  height:300, 

		  title: '登录'

		}); 		
})
 */
 
function submitValue(){
	
	document.getElementById('j_username').value = document.getElementById("username").value;
	document.getElementById('j_password').value = document.getElementById("password").value;
	
	// 设置cookie值
    var tempValue = document.getElementById("username").value;
    setCookie("BMIS_USER_ID1", tempValue, 30);
    
    document.forms['loginForm'].submit();
}

// 校验是否输入正确
function check() {  
    if(document.getElementById("username").value.length==0) {
    	$.messager.alert('提示','请输入用户名');
        document.getElementById("username").focus();
        return false;
    }
    
    if(document.getElementById("password").value.length==0)  {
    	$.messager.alert('提示','请输入密码');  
        document.getElementById("password").focus();
        return false;
    }
    return true;
}

function login() {
	if(!check()) {
		return false; 
	}
	submitValue();
	Ext.get("login").mask('正在登录...');
}


 
<%-- function _login(){
	var user_v = $("#u_id").val();
	var password_v = $("#p_id").val();
	if(user_v==''){
		$.messager.alert('提示','请输入用户名');
		return ;
	}
	if(password_v ==''){
		$.messager.alert('提示','请输入密码');  
		return ;
	}
	//提交
	var url = "<%=basePath%>j_acegi_security_check";
	var form1 = document.getElementById("fm");
	form1.action = url;
	form1.submit();
	
} --%>


//从Cookie获取用户登录ID
function getUsername(){
	var username = getCookie("BMIS_USER_ID1");
	if (username!=null && username!='' ){
		document.getElementById("username").value=username;
		document.getElementById("password").focus();
	}else
		document.getElementById("username").focus();
}


function _reset(){
	$('#fm').form('clear');
}


if(document.addEventListener){//如果是Firefox 
	document.addEventListener("keypress",fireFoxHandler, true); 
	}else{ 
	document.attachEvent("onkeypress",ieHandler); 
	} 

	function fireFoxHandler(evt){ 
		if(evt.keyCode==13){ 
	
			_login();
		} 
	} 

	function ieHandler(evt){ 
	if(evt.keyCode==13){ 
		_login();
	} 
} 



	
</script>
	
	
</head>
  
<body style="overflow: hidden;" scroll="no">
<div  id="login" class="login" >
<div  class="login_div">
<form action="<%=request.getContextPath()%>/j_acegi_security_check" id="loginForm" method="post" name="fm">
 
<input type="hidden" value="" id="j_username" name="j_username"/>
<input type="hidden" value="" id="j_password" name="j_password"/>
<table width="100%" cellpadding="0" cellspacing="0" class="loginin">
	<tr>
		<td valign="top" class="mid" align='center'>
		<table class="box">
			<tr>
				<td>
					<input type="text" id="username" name='userName' class="input_button" onKeyDown="if(event.keyCode==13) event.keyCode=9" size="10" dataType="Require" msg="请输入用户名。"/></td>
				</tr>
				<tr style="height: 15px">
						<td></td>
					</tr>
					<tr>
						<td><input type="password" id="password" name='password' class="input_button" size="25" dataType="Require" msg="请输入密码。" value="123456" /></td>
					</tr>
				</table>
			</td>
		</tr>
		</table>
	<div class="login_oper">
		<a class="bt" href="#" id="submitBtn" onclick="login()"></a>
	</div>
			
 <%-- <table height="50%"  align="center" cellpadding="0" cellspacing="0" id="t_lg" 
	style="position:absolute; top:120px; left:400px; width: 518px;">
	
	<tr>
		<td>
		<div id="p"  title="登录"  style="background:#E8E7EA;padding:1px;" > 
		
			<div style="width: 99%;height: 60px">
				<table style="width: 100%;height:60px" border="0">
					<tr>
					<td align="center">
					</td>
					</tr>
				</table>
			</div>		
			<!-- <div style="width: 100%;height: 120px">
				<table style="width: 100%;height:120px" border="0">
					<tr>
					<td align="right" width="173">登录名：</td>
					<td>
					<input type="text" class="user" id="u_id" value="admin" name="j_username"></td>
					</tr>
					
				    <tr>
				    <td align="right" >密码：</td>
				    <td><input type="password" class="key" id="p_id" value="123456" name='j_password'></td>
				    </tr>
					<tr >
					<td colspan="2" align="center">
					<a href="#" class="easyui-linkbutton" iconCls="icon-ok" onclick="_login()">登录</a> &nbsp; &nbsp;&nbsp; <a href="#" class="easyui-linkbutton" iconCls="icon-no" onclick="_reset()">重置</a>
					</td>
					</tr>
					
				</table>
			</div> -->
					
			
			<div align="center">
				  <% 
				  String error = request.getParameter("error"); 
				  if(error!=null){
				  %>		  
			      <font color="red">
			        	用户验证失败,请重新登录!<BR><BR>
			      </font>
			   		<%} %>
			</div>	
			
 		</div>
        
  </td>
</tr>
</table> --%>
</form>	
</body>

<script type="text/javascript">
//从cookies中获取username
getUsername();

</script>

</html>
